package com.af.security.property;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author : zhenyun.su
 * @comment :
 * @since : 2019/7/10
 */

@Configuration
@ConfigurationProperties(prefix = "asu.jwt")
public class JwtProperties {
    protected final Logger logger = LoggerFactory.getLogger(JwtProperties.class);
    private String secret;
    private String headerKey;
    private String tokenPrefix;
    private Long expiration;

    @PostConstruct
    public void print(){
        logger.debug("load jwt properties, {}", this);
    }

    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public String getHeaderKey() {
        return headerKey;
    }

    public void setHeaderKey(String headerKey) {
        this.headerKey = headerKey;
    }

    public String getTokenPrefix() {
        return tokenPrefix;
    }

    public void setTokenPrefix(String tokenPrefix) {
        this.tokenPrefix = tokenPrefix;
    }

    public Long getExpiration() {
        return expiration;
    }

    public void setExpiration(Long expiration) {
        this.expiration = expiration;
    }

    @Override
    public String toString() {
        return "JwtConfig{" +
                "secret='" + secret + '\'' +
                ", headerKey='" + headerKey + '\'' +
                ", tokenPrefix='" + tokenPrefix + '\'' +
                ", expiration=" + expiration +
                '}';
    }
}